<template>
  <div class="index" >
    <div class="item" id="logininfo" style="background:#ff0000">未登录</div>
    <div class="item" @click="register">1.点击注册登录协议</div>
    <div class="item" @click="toNotifyH5">2.点击跳转需要唤起协议的页面</div>
  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    components: {
    },
    data() {
      return {

      }
    },
    methods: {
      register() {
        this.wccia.registerLogin(function(params) {
          params = decodeURIComponent(params)
          if (params) {
            if (typeof params === 'string') {
              params = JSON.parse(params)
            }
          }
          var div=document.getElementById("logininfo");
          div.style.background="green";
          div.innerHTML = '姓名:' + params.name + ',年龄:' + params.age + ",性别:" + params.sex
        });
        alert('继续点击第2步，跳转页面')
      },
      toNotifyH5() {
        this.utils.doRouter(this, '/h5notify', null)
      }
    },
    created() {
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus">
  .index
    display block
    height 6rem
    line-height 6rem
    .item
      height .6rem
      line-height .6rem
      font-size .4rem
      margin .5rem 0 .5rem 0
      text-align center
      .#logininfo
        padding .2rem
</style>
